home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / boxattr.pprx < prev    next >
Text File  |  1992-03-14  |  5KB  |  250 lines

  1. /*
  2. @BBoxAttr  @P@ICopyright Gold Disk Inc. February, 1992
  3.  
  4. This Genie will change the attributes of a selection of boxes.
  5.  
  6. */
  7. signal on error
  8. signal on syntax
  9.  
  10. pageopts = "OODDEEVENAALL"
  11. cr = '0a'x
  12. counter = 0
  13.  
  14. address command
  15. call SafeEndEdit.rexx()
  16.  
  17. commands.1      = "Position"
  18. commands.1.1    = "left:"cr"top:"
  19. commands.1.2    = "verifynumbers"
  20. commands.2      = "Angle"
  21. commands.2.1    = "Angle:"
  22. commands.2.2    = "verifynumbers"
  23. commands.3      = "Margins"
  24. commands.3.1    = "left:"cr"top:"cr"right:"cr"bottom:"
  25. commands.3.2    = "verifynumbers"
  26. commands.4      = "Standoff"
  27. commands.4.1    = "Standoff:"
  28. commands.4.2    = "verifynumbers"
  29. commands.5      = "Size"
  30. commands.5.1    = "width:"cr"height:"
  31. commands.5.2    = "verifynumbers"
  32. commands.6      = "Offset"
  33. commands.6.1    = "X offset:"cr"Y offset:"
  34. commands.6.2    = "verifynumbers"
  35. commands.7      = "Lock"
  36. commands.7.1    = "Enter Yes or No"
  37. commands.7.2    = "yntonumbers"
  38. commands.8      = "TextWrap"
  39. commands.8.1    = "Enter Type:"cr"Side:"
  40. commands.8.2    = "verifynumbers"
  41. commands.9      = "Hide"
  42. commands.9.1    = "Enter Yes or No"
  43. commands.9.2    = "yntonumbers"
  44. commands.10     = "Frame"
  45. commands.10.1   = "Enter Yes or No"
  46. commands.10.2   = "yntonumbers"
  47. commands.11     = "Transparent"
  48. commands.11.1   = "Enter Yes or No"
  49. commands.11.2   = "yntonumbers"
  50. commands.12     = "FrameData"
  51. commands.12.1   = "Line Color:"cr"Fill Color:"cr"Line Weight:"cr"Line Pattern:"cr"Fill Pattern:"
  52. commands.12.2   = ""
  53. commands.13     = "Tabs"
  54. commands.13.1   = "Tabs:"
  55. commands.13.2   = "verifytabs"
  56. commands.14     = "Scale"
  57. commands.14.1   = "X Scale:"cr"Y Scale:"
  58. commands.14.2   = "verifynumbers"
  59.  
  60. command = ''
  61.  
  62. do i = 1 to 14
  63.  
  64.     command = command||commands.i||cr
  65.  
  66. end
  67.  
  68. command = left(command, length(command) - 1)
  69.  
  70. do forever
  71.  
  72.     box = ppm_ClickOnBox("Click on boxes to apply attributes..")
  73.     if box = 0 then break
  74.  
  75.     counter = counter + 1
  76.     boxes.counter = box
  77.  
  78.     call ppm_SelectBox(box)
  79.  
  80. end
  81.  
  82. if counter = 0 then exit_msg()
  83.  
  84. call ppm_AutoUpdate(0)
  85. commands = ppm_SelectFromList("Select command to apply to boxes..",30,5,1,command)
  86. if commands = '' then exit_msg()
  87.  
  88. com = 0
  89.  
  90. do while commands ~= ''
  91.  
  92.     com = com + 1
  93.     parse var commands command.com '0a'x commands
  94.  
  95.     do i = 1 to 14
  96.         if command.com = commands.i then leave
  97.     end
  98.  
  99.     if pos(':', commands.i.1) ~= 0 then
  100.     do
  101.        interpret "settings = ppm_GetBox"command.com"(boxes.1)"
  102.        commands.i.1 = stuffsettings(settings, commands.i.1)
  103.     end
  104.  
  105.     args.com = ppm_GetForm("Enter Values for "command.com, min(length(commands.i.1), 40), commands.i.1)
  106.     if args.com = '' then exit_msg()
  107.  
  108.     if command.com = "Tabs" then 
  109.        args.com = verifytabs(args.com)
  110.     else
  111.        args.com = separate(args.com, commands.i.2)
  112.  
  113. end
  114.  
  115.  
  116. do i = 1 to counter
  117.  
  118.     do c = 1 to com
  119.  
  120.         interpret "call ppm_SetBox"command.c"(boxes.i,"args.c")"
  121.  
  122.     end
  123.  
  124. end
  125.  
  126. call exit_msg()
  127.  
  128. error:
  129. syntax:
  130. do
  131.     exit_msg("Genie failed due to error: "errortext(rc))
  132. end
  133.  
  134. exit_msg:
  135. do
  136.     parse arg message
  137.  
  138.     if message ~= '' then
  139.         call ppm_Inform(1, message,)
  140.  
  141.    call ppm_ClearStatus()
  142.     call ppm_AutoUpdate(1)
  143.     exit
  144. end
  145.  
  146. separate:
  147. do
  148.     parse arg string, vfunction
  149.  
  150.     output  = ''
  151.  
  152.     do forever
  153.  
  154.         parse var string item '0a'x string
  155.  
  156.       if vfunction ~= '' then
  157.            interpret "item = "vfunction"("item")"
  158.  
  159.         item = "'"item"'"
  160.  
  161.         if string = '' then 
  162.             return(output||item)
  163.         else
  164.             output = output||item","
  165.     end
  166. end
  167.  
  168. verifynumbers: procedure
  169. do
  170.     parse arg number
  171.  
  172.     if ~datatype(number, n) then exit_msg("Invalid input")
  173.     return(number)
  174.  
  175. end
  176.  
  177.  
  178. yntonumbers: procedure 
  179. do
  180.     parse arg type
  181.  
  182.     type = upper(type)
  183.  
  184.     if left(type, 1) = "Y" then return(1)
  185.     if left(type, 1) = "N" then return(0)
  186.     call exit_msg("Invalid Entry")
  187. end
  188.  
  189. verifytabs: procedure 
  190. do
  191.    parse arg tabs
  192.  
  193.    output = ''
  194.  
  195.    tabs = strip(tabs)
  196.  
  197.    do 16
  198.  
  199.       parse var tabs tab ' ' tabs
  200.  
  201.       if tab = '' then tab = 0
  202.       if ~datatype(tab, n) then exit_msg("Invalid Entry")
  203.  
  204.       output = output" "tab
  205.  
  206.       tabs = strip(tabs)
  207.  
  208.    end
  209.  
  210.    return('"'output'"')
  211. end
  212.  
  213. stuffsettings: procedure
  214. do
  215.    parse arg settings, prompt
  216.  
  217.    output = ''
  218.    counter = 1
  219.    colon = pos(':', prompt)
  220.    cr = pos('0a'x, settings)
  221.  
  222.    if cr ~= 0 then
  223.    do
  224.        do while colon ~= 0
  225.              
  226.           parse var settings default '0a'x settings
  227.  
  228.           prompt = insert(default, prompt, colon)
  229.           colon = pos(':', prompt, colon + 1)
  230.  
  231.        end
  232.  
  233.        return(prompt)
  234.  
  235.   end
  236.  
  237.    do while colon ~= 0
  238.  
  239.       prompt = insert(word(settings, counter), prompt, colon)
  240.       counter = counter + 1
  241.  
  242.       colon = pos(':', prompt, colon + 1)
  243.    end
  244.  
  245.    prompt = prompt" " || subword(settings, counter)
  246.  
  247.    return(prompt)
  248.  
  249. end
  250.